package com.wht.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wht.domain.DtsUser;
import com.wht.mapper.DtsUserMapper;
import com.wht.mapper.StatMapper;
import com.wht.service.DtsUserService;
import com.wht.vo.DayStatis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wanghaotian
 * time:2022/12/02,0002 15:07
 * description:
 */

@Service
public class DtsUserServiceImpl implements DtsUserService {

    @Autowired
    private DtsUserMapper userMapper;

    @Autowired
    private StatMapper statMapper;
    

    @Override
    public int count() {
        QueryWrapper<DtsUser> wrapper = new QueryWrapper<>();
        wrapper.eq("deleted", false);
        Integer count = userMapper.selectCount(wrapper);
        return count;
    }

    @Override
    public List<DtsUser> findAll() {
        QueryWrapper<DtsUser> wrapper = new QueryWrapper<>();
        wrapper.eq("deleted", false);
        return userMapper.selectList(wrapper);

    }

    @Override
    public List<DayStatis> recentCount(int statisDaysRang) {
        List<DayStatis> list = statMapper.statisIncreaseUserCnt(statisDaysRang);
        return list;
    }
}
